package com.jzo2o.foundations.controller.inner;

import cn.hutool.core.bean.BeanUtil;
import com.jzo2o.api.foundations.ServeApi;
import com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO;
import com.jzo2o.foundations.service.IServeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author itlxc
 * @since 2024-10-18
 */
@RestController
@RequestMapping("inner/serve")
@Api(tags = "内部接口 - 服务相关接口")
@RequiredArgsConstructor
@Slf4j
public class InnerServeController implements ServeApi {

    private final IServeService serveService;

    @Override
    @GetMapping("/{id}")
    @ApiOperation("根据服务id查询服务详情")
    public ServeAggregationResDTO findById(@PathVariable("id") Long id) {
        log.info("获取服务详情参数：{}", id);
        return BeanUtil.toBean(serveService.getById(id), ServeAggregationResDTO.class);
    }
}
